<?php

namespace app\mall\validate\product;

use think\Validate;

/**
 * 验证
 */
class Product extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id'     => 'require|number',
        'num'    => 'require|number|gt:0',
        'credit' => 'require|number',
    ];

    protected $field = [
        'id'     => '商品',
        'num'    => '商品数量',
        'credit' => '积分'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [

    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'submit_order' => ['id', 'num', 'credit'],
    ];

}
